package day8;

public class StudentTest {
    public static void main(String[] args) {
        Student []arr = new Student[5];
        arr[0] =new Student(001,"老黄",18);
        arr[1] =new Student(002,"老红",18);
        arr[2] =new Student(003,"老吕",18);
        arr[3] = new Student();
        arr[3].gets();
        for (int i = 0; i < 3; i++) {
            if(arr[i]!=null){
                if(arr[3].id == arr[i].id) {
                    System.out.println("输入学号重复。");
                    arr[3] = null;
                    return;
                }
            }
        }
        for (int i = 0; i < arr.length; i++) {
            if(arr[i]!=null) {
                System.out.println(arr[i].id + "," + arr[i].name + "," + arr[i].age);
            }
        }
    }
}
